import {Component} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {PageVoService} from '../../service/page-vo.service';
import {DocService} from '../../service/doc.service';
import {MessageService} from '../../service/message.service';
import {BaseApiComponent} from './base-api.component';
import {Menu} from '../../entity/menu';

@Component({
    selector: 'app-page-api',
    templateUrl: './page-api.component.html',
    styleUrls: ['./page-api.component.css']
})
export class PageApiComponent extends BaseApiComponent {
    constructor(protected pageVoService: PageVoService,
                protected activatedRoute: ActivatedRoute,
                protected router: Router,
                protected docService: DocService,
                protected messageService: MessageService) {
        super(pageVoService, activatedRoute, router, docService, messageService);
    }

    setStatus(status: string) {
        this.status = status;
    }

    protected getActiveMenuId(): string {
        return this.apiId;
    }

    /**
     * 获取左侧菜单路由后缀
     * @returns {string[]}
     */
    getLeftMenuRoutes(menu: Menu, page: PageApiComponent): string[] {
        if (page.apiVersion) {
            return ['v', page.apiVersion.toString()];
        }
        return null;
    }

    protected onApiReady() {
    }
}
